from urllib.parse import quote_plus

from pymongo import MongoClient


class MongoDBUtil:
    def __init__(self, host, port, user, password, db_name):
        self.__mongodb_uri = "mongodb://%s:%d" % (host, port)
        print(self.__mongodb_uri)
        self.client = MongoClient(self.__mongodb_uri)
        self.database = self.client[db_name]
        self.database.authenticate(user, password)
